fix(ai): drop effort markers when thinking is disabled - #1399
Open
chupe wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes generated per-turn effort markers when an Anthropic request disables thinking.
disableThinkingForRequest()already removed top-leveloutput_config, but historical and current effort-only system messages survived and could triggermessages.N: output_config.effort 'xhigh' is not supported when thinking is disabled.The cleanup runs only after the cannot-disable early return. It preserves enabled
xhigh/max, models that cannot disable thinking, persisted history, tool pairs, and cache checkpoints.Related merged work: #351 and #380. Those changes establish thinking compatibility and cross-model degradation but do not remove these generated history markers.
Verification
bun run checkbuild:offlineExact commands and sanitized receipts are retained locally under
local-ignore/qa-evidence/20260905-effort-upstream/(red.txt,green.txt,cli-qa.json,README.md), excluded from Git per repository policy. CLI cases use the repository's QA sandbox and localhost fake-model helpers.Scope and risk
The production change is ten lines in the existing disable path. Tests cover the final SDK request, caller-context immutability, signed-thinking replay, cache controls, and both cannot-disable gates. No dependency or lockfile changes. LSP initialization was unavailable with TypeScript 7; repository compiler/build checks passed.
Summary by cubic
Fixes the Anthropic request builder so per-turn effort markers are removed when thinking is disabled, preventing
output_config.efforterrors on requests that disable thinking explicitly or through cross-model tool continuation.Previously only top-level
output_configwas stripped, leaving historical and current effort-only system messages. The cleanup now filters those messages whendisableThinkingForRequest()emitsthinking: { type: "disabled" }. Enabledxhigh/maxreasoning, models that cannot disable thinking, persisted history, tool pairs, and cache checkpoints are unaffected.Written for commit 655226e. Summary will update on new commits.